//
//  JSMeAttontionFansCell.m
//  NiubilityProject
//
//  Created by Apple on 2017/11/23.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import "JSMeAttontionFansCell.h"


@interface JSMeAttontionFansCell ()

/** */
@property (nonatomic, strong) CALayer *line;

@end

@implementation JSMeAttontionFansCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _line = [CALayer layer];
        _line.backgroundColor = JS_colorWithHex(0xe7e7e7).CGColor;
        [self.contentView.layer addSublayer:_line];
        _attentionNumberL = [YYLabel new];
        _attentionNumberL.text = @"0";
        _attentionNumberL.textAlignment = NSTextAlignmentCenter;
        JSSetingLableInfo(_attentionNumberL, 13, JS_colorWithHex(kColorBlack3));
        YYLabel *attentionL = [YYLabel new];
        attentionL.textAlignment = NSTextAlignmentCenter;
        attentionL.text = JSLocalizedString(@"attentionLoca");
        JSSetingLableInfo(attentionL, 13, JS_colorWithHex(kColorGray3));
        [self.contentView js_addSubviews:@[_attentionNumberL,attentionL]];
        [_attentionNumberL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.and.left.equalTo(self.contentView);
            make.width.equalTo(self.contentView).multipliedBy(0.5);
            make.height.equalTo(self.contentView).multipliedBy(0.5);
        }];
        [attentionL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.and.bottom.equalTo(self.contentView);
            make.top.equalTo(self.attentionNumberL.mas_bottom);
            make.right.equalTo(self.attentionNumberL);
        }];
        _fansNumberL = [YYLabel new];
        _fansNumberL.text = @"0";
        _fansNumberL.textAlignment = NSTextAlignmentCenter;
        JSSetingLableInfo(_fansNumberL, 13, JS_colorWithHex(kColorBlack3));
        YYLabel *fansL = [YYLabel new];
        fansL.textAlignment = NSTextAlignmentCenter;
        fansL.text = JSLocalizedString(@"fansLoca");
        JSSetingLableInfo(fansL, 13, JS_colorWithHex(kColorGray3));
        [self.contentView js_addSubviews:@[_fansNumberL,fansL]];
        [_fansNumberL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.and.right.equalTo(self.contentView);
            make.left.equalTo(self.attentionNumberL.mas_right);
            make.bottom.equalTo(self.attentionNumberL.mas_bottom);
        }];
        [fansL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.fansNumberL.mas_bottom);
            make.right.and.bottom.equalTo(self.contentView);
            make.left.equalTo(self.fansNumberL.mas_left);
        }];
        UIButton *attentionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        attentionBtn.tag = 10;
        UIButton *fansBtn      = [UIButton buttonWithType:UIButtonTypeCustom];
        fansBtn.tag = 11;
        [self.contentView js_addSubviews:@[attentionBtn,fansBtn]];
        [attentionBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        [fansBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];

    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)btnClick:(UIButton *)sender {
    if (self.btnClick) {
        self.btnClick(sender.tag - 10);
    }
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.line.frame = CGRectMake(self.contentView.js_width / 2.f, (self.contentView.js_height - (kRealValue(25)))/2.f, 1, kRealValue(25));
    
    
}

@end
